package com.great.start;
import java.applet.AudioClip;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import com.xiaoleilu.hutool.io.FileUtil;
import com.xiaoleilu.hutool.util.URLUtil;

/**
 * 闹钟
 * @author Administrator
 * 早起虽难，但是每天充满希望和激情，大概，也许，可能，能起来吧。
 * 毕竟没有希望和激情....
 */
public class AlarmClock implements Runnable {
	
	
	public void run(){
		Util.print_sys("执行闹钟");
		
	}
	
	/**
	 * 获取本次需要播放的音乐
	 * @throws IOException
	 */
	public void getPlayMick() throws IOException{
		//获取歌单目录
		String MusicId =  GetProperties.getName("MusicPath");
//		Map<String, String> mp3Map = Util.getDirectory(new File("D:\\Youxun"));
//		for (Map.Entry<String, String> entry : mp3Map.entrySet()) {  
//		    System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());  
//		}
		//获取上次播放截止的音乐
		List<String> mp3List = Util.getDirectory(new File("D:\\CloudMusic"));
		for (String string : mp3List) {
			System.out.println(string);
		}
		//随机播放
        
        
	}     
	
	
	/**
	 * 播放今天天气
	 * 注：获取天气状况的代码，是我之前用python写好的代码，在这里就直接调用，就不在重复实现了。
	 */
	public void weather(){
		
	}
	
	public static void main(String[] args) throws IOException {
		AlarmClock alarm = new AlarmClock();
		alarm.getPlayMick();
	}
	
	public void getMick() throws IOException{
		//获取歌单Id
		String MusicId =  GetProperties.getName("MusicId");
		 List ids =  MusicApi.getPlaylist_detail(MusicId);
		 
		 List urls = MusicApi.getMusic_url(ids);
		 for (Object url : urls) {
			 String urlStr = url.toString();
			 
			 File mp3 = FileUtil.file(URLUtil.url("http://m10.music.126.net/20170929174518/3b92661f7a210e61d2ffc743bbebf2f8/ymusic/f1ae/0bd1/31a9/5d64960d0cbebc0d089bc85a6ef54680.mp3"));
			 mp3.mkdir();
		}
		
	}
	
	
	
	
}
